import request from '@/utils/request'

export class GoodQuery {
  constructor(query) {
    this.pages = query.pageSize
    this.current = query.pageNum || query.page
    this.records = [query]
  }
}

// 查询品牌列表
export function listBrand(query) {
  return request({
    url: '/h2-shop-brand/page',
    method: 'post',
    data: new GoodQuery(query)
  })
}

// 查询品牌详细
export function getBrand(id) {
  return request({
    url: '/good/brand/' + id,
    method: 'get'
  })
}

// 新增品牌
export function addBrand(data) {
  return request({
    url: '/h2-shop-brand/save',
    method: 'post',
    data: data
  })
}

// 修改品牌
export function updateBrand(data) {
  return request({
    url: '/good/brand',
    method: 'put',
    data: data
  })
}

// 删除品牌
export function delBrand(id) {
  return request({
    url: `/h2-shop-brand/${id}`,
    method: 'delete'
  })
}
